.max-width-600
  - if resource.link_previews.any?
    %h4.text-subtitle-2= t :'common.links'
    %ul.thread-mailer__list
      - resource.link_previews.each do |preview|
        %div{style: "border: 1px solid #eee; border-radius: 4px; margin-bottom: 8px"}
          - if preview['image'].present?
            %a{href: preview['url']}
              %div.link-preview__image{style: "height: 128px; overflow: none; background: url('#{preview['image']}') center / cover no-repeat)"}
          %a.text-h6{href: preview['url']}= preview['title']
          - if preview['description'].present?
            %p= preview['description']

  - if resource.attachments.any?
    %h4.text-subtitle-2= t :'common.attachments'
    %ul.thread-mailer__list
      - resource.files.each do |file|
        - download_url = Rails.application.routes.url_helpers.rails_blob_url(file, only_path: false, host: ENV['CANONICAL_HOST'])
        %div{style: "border: 1px solid #eee; border-radius: 4px; margin-bottom: 8px"}
          %span 📎
          %a.thread-mailer__file-attachment{href: download_url, target: '_blank'}
            %span.thread-mailer__file-attachment-filername
              = file.blob.filename
          %span=number_to_human_size file.byte_size
          - if file.representable?
            - preview_url = Rails.application.routes.url_helpers.rails_representation_url(file.representation(HasRichText::PREVIEW_OPTIONS), only_path: false, host: ENV['CANONICAL_HOST'])
            %a{href: download_url, target: '_blank'}
              %div.link-preview__image{alt: file.blob.filename, style: "height: 128px; overflow: none; background: url('#{preview_url}') center / contain no-repeat)"}
